from tortoise import fields, models
class ElectricPriceValue(models.Model):
    price_value_id = fields.IntField(pk=True)
    price = fields.ForeignKeyField('models.ElectricPriceInfo', related_name='price_values', on_delete=fields.CASCADE)
    time_point = fields.DatetimeField()
    price_amount = fields.DecimalField(max_digits=10, decimal_places=4, description="电价数值")

    class Meta:
        table = "electric_price_value"

    def __str__(self):
        return f"{self.price_amount} at {self.time_point}"